<?php
    require_once 'Dsql.php';
    
    
    if(isset($_GET['aphoId'])){
        $arr = explode("_", $_GET['aphoId']);
        $aphoId = $arr[1]*1;
    }else{
        $aphoId  = "0";
    }
    
    
    $db = new Dsql("mysql-88.ukraine.com.ua", "barthez_ai", "x9gedv4w");
    
    $db->selectCharset('utf8');
    $db->selectDb('barthez_ai');
    
    
    
    $qs = "UPDATE `byone` SET `rate`=`rate`+1 WHERE `aphorismId`=$aphoId";
    $db->createQuery($qs)
       ->execute();

    $qs = "UPDATE `aphoAuthors` SET `rate`=`rate`+1 WHERE id=(SELECT autorId FROM `byone` WHERE `aphorismId`= $aphoId)";
    
    
    $db->createQuery($qs)
       ->execute();
    
    die;
    
?>
